﻿#pragma once

#include "spdlog/spdlog.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/fmt/ostr.h"
extern std::shared_ptr<spdlog::logger> logger ;

#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QGridLayout"
#include "QVBoxLayout"
#include "QLabel"
#include "QSpinBox"
#include "show_qlabel.h"
#include "QComboBox"

#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

#include <fstream>
#include "nlohmann/json.hpp"
using json = nlohmann::json;

#include "commonfunction.h"
extern QImage matToQImage(const Mat mat_in);

#include "camera_Interface.h"
class CameraHkQDialog : public QDialog
{
    Q_OBJECT

public:
    json m_json_data;

    ShowQLabel * m_showqlable;

    QLabel * m_qlabel_exposure_time;
    QSpinBox * m_qspinbox_exposure_time;

    QLabel * m_qlabel_gain;
    QSpinBox * m_qspinbox_gain;

    QLabel   *   m_qlabel_trigger_mode;
    QComboBox*   m_qcombox_trigger_mode;

    QLabel   *   m_qlabel_trigger_source;
    QComboBox*   m_qcombox_trigger_source;


    QPushButton* m_qpushbutton_soft_triger;

    QPushButton* m_qpushbutton_save;
    QPushButton* m_qpushbutton_hide;


    cv::Mat m_image ;
    QString m_path_para = "prar.json";
    QString m_section   = "error";

    CameraInterface* m_camera_interface = nullptr;
public:
    explicit CameraHkQDialog(QDialog *parent,QString path_in,QString section);
    bool initCamera(QString name,CameraCallback pfunction, void *pcontext);
    void loadParameter();
    void saveParameter();
    void showImage(Mat image,int camera_index,int index);
    void softTrigger();


};
#pragma execution_character_set("utf-8")
